import { h } from '@knno/dom/jsx';
import { Cell, CellProps, Option, TreeOption } from './cell';

type SelectType = 'single' | 'multiple';
type SelectCellValueType<T extends SelectType> = T extends 'single' ? Option : T extends 'multiple' ? Option[] : never;

export interface SelectCellProps<T extends SelectType>
	extends CellProps<SelectCell<T>, SelectCellProps<T>, SelectCellValueType<T>> {
	type: T;
	popupWidth?: number | string;
	disableField?: number | string;
	noSelectField?: number | string;
	resultTextField?: number | string;
	/**
	 * Whether to return the full path of the selection, which can be a boolean or a string. If it is a string, it is considered that the full path is returned, and the specified string is used as the path separator.
	 */
	resultFullPath?: string | boolean;
	value?: SelectCellValueType<T>;
	options: TreeOption[];
}

export class SelectCell<T extends SelectType> extends Cell<SelectCell<T>, SelectCellProps<T>, SelectCellValueType<T>> {
	init() {
		// TODO
	}

	protected update(): void {
		throw new Error('Method not implemented.');
	}
}
